package domain;

import common.DomainException;

public class Unit {

    private UnitType type;
    private String name;

    protected Unit(String name, UnitType type) throws DomainException {
        if (!name.equals("")) {
            this.name = name;
            this.type = type;
        } else {
            throw new DomainException("Name cannot be empty.");
        }
    }

    public UnitType getType() {
        return type;
    }

    protected void setType(UnitType type) {
        this.type = type;
    }

    public String getName() {
        return name;
    }

    protected void setName(String name) {
        this.name = name;
    }
    
    @Override
    public String toString(){
        return this.name;
    }
}
